package com.abe.hello.base.exception;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import org.springframework.web.bind.annotation.ExceptionHandler;

public class CoreExceptionController {
	@ExceptionHandler(Exception.class)
	public CommonErrorInfo<String> handleException(Exception e) {
		CommonErrorInfo<String> CommonErrorInfo = new CommonErrorInfo<String>();
		ByteArrayOutputStream baos = new ByteArrayOutputStream();  
		e.printStackTrace(new PrintStream(baos));  
		String exception = baos.toString();  
		CommonErrorInfo.setMessage(e.getMessage());
		CommonErrorInfo.setData(exception);
		CommonErrorInfo.setCode(ErrorResultCode.ERROR);
		return CommonErrorInfo;
	}


}
